/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
 */
package cn.ibizlab.core.oauth2.domain;

import java.util.*;
import cn.ibizlab.util.domain.IEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.EntityMP;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * RefreshToken实体类[OauthRefreshToken]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@TableName(value = "oauth_refresh_token", resultMap = "OauthRefreshTokenResultMap")
@ApiModel(value = "OAUTH_REFRESH_TOKEN", description = "RefreshToken")
public class OauthRefreshToken extends EntityMP implements Serializable
{

    /**
     * token标识
     */
    @Id
    @TableId(value = "token_id" , type = IdType.ASSIGN_UUID)
    @DEField(name = "token_id" , isKeyField = true)
    @JsonProperty("token_id")
    @JSONField(name = "token_id")
    @ApiModelProperty(value = "token_id", notes = "token标识")
    private String tokenId;

    /**
     * token
     */
    @TableField(value = "token", typeHandler = cn.ibizlab.util.helper.typehandler.ByteArrayToStringTypeHandler.class)
    @DEField(name = "token")
    @JsonProperty("token")
    @JSONField(name = "token")
    @ApiModelProperty(value = "token", notes = "token")
    private String token;

    /**
     * authentication
     */
    @TableField(value = "authentication", typeHandler = cn.ibizlab.util.helper.typehandler.ByteArrayToStringTypeHandler.class)
    @DEField(name = "authentication")
    @JsonProperty("authentication")
    @JSONField(name = "authentication")
    @ApiModelProperty(value = "authentication", notes = "authentication")
    private String authentication;

    /**
     * 设置 [token]
     */
    public OauthRefreshToken setToken(String token) {
        this.token = token;
        this.modify("token", token);
        return this;
    }

    /**
     * 设置 [authentication]
     */
    public OauthRefreshToken setAuthentication(String authentication) {
        this.authentication = authentication;
        this.modify("authentication", authentication);
        return this;
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("token_id");
        }
        return targetEntity;
    }

}